Move extra Repo methods to plain impl as well
authorFelix Krull <f_krull@gmx.de>
Fri, 24 May 2019 20:39:24 +0000 (22:39 +0200)
committerColin Walters <walters@verbum.org>
Fri, 6 May 2022 16:53:54 +0000 (12:53 -0400)
rust-bindings/rust/conf/ostree.toml
rust-bindings/rust/src/lib.rs
rust-bindings/rust/src/repo.rs

index e54a88e470cf9dbfadcb6d03abcdce4db9a94340..25d5085cb64d7494e2ba08e6015bf9fba812aed1 100644 (file)
@@ -85,7 +85,6 @@ status = "generate"
 [[object]]
 name = "OSTree.Repo"
 status = "generate"
-manual_traits = ["RepoExtManual"]
     [[object.function]]
     # crashes while generating, not sure what's wrong with this; might be a gir issue
     name = "write_metadata_async"
index a327082430b6ca40234d7fc34abc0e42a2d7b937..7fb6f836327f153678dccf1f881f841b08cda6b0 100644 (file)
@@ -35,5 +35,4 @@ mod tests;
 // prelude
 pub mod prelude {
     pub use crate::auto::traits::*;
-    pub use crate::repo::RepoExtManual;
 }
index 3b493a86f0805510e253f41eb4a2393cd147db37..6a7c5933771db79da793ace58c0beba1653ceb45 100644 (file)
@@ -34,38 +34,12 @@ unsafe fn from_glib_container_variant_set(ptr: *mut glib_sys::GHashTable) -> Has
     set
 }
 
-pub trait RepoExtManual {
-    fn new_for_path<P: AsRef<Path>>(path: P) -> Repo;
-
-    fn traverse_commit<P: IsA<gio::Cancellable>>(
-        &self,
-        commit_checksum: &str,
-        maxdepth: i32,
-        cancellable: Option<&P>,
-    ) -> Result<HashSet<ObjectName>, Error>;
-
-    // TODO: return GString?
-    fn list_refs<P: IsA<gio::Cancellable>>(
-        &self,
-        refspec_prefix: Option<&str>,
-        cancellable: Option<&P>,
-    ) -> Result<HashMap<String, String>, Error>;
-
-    #[cfg(any(feature = "v2016_4", feature = "dox"))]
-    fn list_refs_ext<P: IsA<gio::Cancellable>>(
-        &self,
-        refspec_prefix: Option<&str>,
-        flags: RepoListRefsExtFlags,
-        cancellable: Option<&P>,
-    ) -> Result<HashMap<String, String>, Error>;
-}
-
-impl<O: IsA<Repo>> RepoExtManual for O {
-    fn new_for_path<P: AsRef<Path>>(path: P) -> Repo {
+impl Repo {
+    pub fn new_for_path<P: AsRef<Path>>(path: P) -> Repo {
         Repo::new(&gio::File::new_for_path(path.as_ref()))
     }
 
-    fn traverse_commit<P: IsA<gio::Cancellable>>(
+    pub fn traverse_commit<P: IsA<gio::Cancellable>>(
         &self,
         commit_checksum: &str,
         maxdepth: i32,
@@ -75,7 +49,7 @@ impl<O: IsA<Repo>> RepoExtManual for O {
             let mut error = ptr::null_mut();
             let mut hashtable = ptr::null_mut();
             let _ = ostree_sys::ostree_repo_traverse_commit(
-                self.as_ref().to_glib_none().0,
+                self.to_glib_none().0,
                 commit_checksum.to_glib_none().0,
                 maxdepth,
                 &mut hashtable,
@@ -90,7 +64,7 @@ impl<O: IsA<Repo>> RepoExtManual for O {
         }
     }
 
-    fn list_refs<P: IsA<gio::Cancellable>>(
+    pub fn list_refs<P: IsA<gio::Cancellable>>(
         &self,
         refspec_prefix: Option<&str>,
         cancellable: Option<&P>,
@@ -99,7 +73,7 @@ impl<O: IsA<Repo>> RepoExtManual for O {
             let mut error = ptr::null_mut();
             let mut hashtable = ptr::null_mut();
             let _ = ostree_sys::ostree_repo_list_refs(
-                self.as_ref().to_glib_none().0,
+                self.to_glib_none().0,
                 refspec_prefix.to_glib_none().0,
                 &mut hashtable,
                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
@@ -115,7 +89,7 @@ impl<O: IsA<Repo>> RepoExtManual for O {
     }
 
     #[cfg(any(feature = "v2016_4", feature = "dox"))]
-    fn list_refs_ext<P: IsA<gio::Cancellable>>(
+    pub fn list_refs_ext<P: IsA<gio::Cancellable>>(
         &self,
         refspec_prefix: Option<&str>,
         flags: RepoListRefsExtFlags,
@@ -125,7 +99,7 @@ impl<O: IsA<Repo>> RepoExtManual for O {
             let mut error = ptr::null_mut();
             let mut hashtable = ptr::null_mut();
             let _ = ostree_sys::ostree_repo_list_refs_ext(
-                self.as_ref().to_glib_none().0,
+                self.to_glib_none().0,
                 refspec_prefix.to_glib_none().0,
                 &mut hashtable,
                 flags.to_glib(),